package com.neu.demo02.service;

import com.neu.demo02.dto.UserInfoDto;
import com.neu.demo02.mapper.UserInfoMapper;
import com.neu.demo02.po.UserInfo;
import com.neu.demo02.util.CommonResult;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class UserInfoService {
    @Resource
    private UserInfoMapper userInfoMapper;

    public CommonResult findUsers(UserInfoDto dto){
        CommonResult rst = new CommonResult();
        List<UserInfo> userInfos = userInfoMapper.findUsers(dto);
        rst.setRst(userInfos);
        return rst;
    }
    public CommonResult doSave(UserInfoDto dto){
        CommonResult rst=new CommonResult();
        int row=userInfoMapper.save(dto);
        if(row==0){
            rst.setCode(100);
            rst.setMsg("失败");
        }
        return rst;
    }
}
